# -*- coding: gb2312 -*-
from OpenAndRleated import OpenAndRelated

from EPS_PE_PB_PEG import EPS_PE_PB_PEG

from BuySellAmount import BuySellAmount

from DailyClose import DailyClose

from MarketValueData import StockMarketValues

from StatusDailyData import StockGeneralData

from DateGeneralFunctions import DateGeneralFunctions


########################################################

# start updating open and related daily factors
objOpenRelated = OpenAndRelated()

objOpenRelated.updateOpenToMongoDB()

objOpenRelated.updateHighToMongoDB()

objOpenRelated.updateLowToMongoDB()

objOpenRelated.updateVolumeToMongoDB()

objOpenRelated.updateVwapToMongoDB()

objOpenRelated.updateAmtToMongoDB()

# end of updating open and related daily factors

#########################################################
# start updating financial daily factors
objFinancial = EPS_PE_PB_PEG()

objFinancial.updateReciprocal_PE_ttmToMongoDB()

objFinancial.updatePB_lfToMongoDB()

objFinancial.updatePE_ttmToMongoDB()

objFinancial.updateRoaToMongoDB()

objFinancial.updateEPS_ttmToMongoDB()

objFinancial.updateStmIssuingDatesToMongoDB()
# end of updating financial daily factors


##########################################################
# start updating buy sell daily factors
objBuySellAmt = BuySellAmount()
objBuySellAmt.updateBaseBuySellToMongoDB('mfd_buyamt_d', '4')

objBuySellAmt.updateBaseBuySellToMongoDB('mfd_buyamt_d', '1')

# end of updating buy sell daily factors


##########################################################
# start updating stock close daily  factors
objClose = DailyClose()
objClose.updateStocksCloseToMongoDB()

objClose.updateIndicesCloseToMongoDB()

objClose.updateAdjFactorToMongoDB()

# end of updating stock close daily factors


#########################################################
# start updating stock close daily  factors
objStockMarket = StockMarketValues()

objStockMarket.updateMktFreeSharesToMongoDB()

objStockMarket.updateEvToMongoDB()
# end of updating stock close daily factors

##########################################################
# start updating stock close daily  factors
objStockGeneralData = StockGeneralData()

objStockGeneralData.updateTradeStatusToMongoDB()

objStockGeneralData.updateSwingToMongoDB()

objStockGeneralData.updateIpoDateToMongoDB()

# end of updating stock close daily factors

##########################################################
#start updating stock close daily  factors
DateGenFuncObj = DateGeneralFunctions()

DateGenFuncObj.updatePeriodEndTransDatesToMongoDB('trans_dates', 'trans_dates_update_date', 'transaction days')
#end of updating stock close daily factors
##########################################################